/*
 * @Description:
 * @Author:
 * @Date: 2024-11-02 13:47:55
 * @LastEditTime: 2024-11-02 22:23:52
 * @LastEditors: XXX
 */
import type { MutationTree } from 'vuex'
import type { SettingState } from './state'

import { SettingsMutationTypes } from './mutation-types'

interface PayloadType {
  key: string
  value: any
}

export type Mutations<S = SettingState> = {
  [SettingsMutationTypes.CHANGE_SETTING] (state: S, payload: PayloadType): void
}

export const mutations: MutationTree<SettingState> & Mutations = {
  [SettingsMutationTypes.CHANGE_SETTING] (state: SettingState, payload: PayloadType) {
    const { key, value } = payload

    switch (key) {
      case 'showSidebarLogo':
        state.showSidebarLogo = value
        break
      default:
        break
    }
  }
}
